package com.example.farmer.Entity;

public class ProductPost {
    private int id;
    private String imageUri;

    private String title;//货品标题
    private String producttype;//货品分类
    private double prices;//货品单价
    private double freight; //货品运费
    private String shipaddress; //发货地址
    private String pushtype;//发布类型
    private String userNumber;
    private boolean hasImage; // 指示是否有关联的图片


    public ProductPost(int id, String imageUri, String title, String producttype,
                       double prices, double freight, String shipaddress,String pushtype,String userNumber){
        this.id = id;
        this.imageUri = imageUri;
        this.title = title;
        this.producttype = producttype;
        this.prices = prices;
        this.freight = freight;
        this.shipaddress = shipaddress;
        this.pushtype = pushtype;
        this.userNumber = userNumber;
    }

    public ProductPost(String imageUri, String title, String producttype,
                       double prices, double freight, String shipaddress,String pushtype,String userNumber){
        this.imageUri = imageUri;
        this.title = title;
        this.producttype = producttype;
        this.prices = prices;
        this.freight = freight;
        this.shipaddress = shipaddress;
        this.pushtype = pushtype;
        this.userNumber = userNumber;
    }
    public ProductPost(int id,String title, String producttype,
                       double prices, double freight, String shipaddress,String imageUri){
        this.id = id;
        this.title = title;
        this.producttype = producttype;
        this.prices = prices;
        this.freight = freight;
        this.shipaddress = shipaddress;
        this.imageUri = imageUri;
    }
    public ProductPost(int id,String title, String producttype,
                       double prices, double freight,String imageUri){
        this.id = id;
        this.title = title;
        this.producttype = producttype;
        this.prices = prices;
        this.freight = freight;
        this.imageUri = imageUri;
    }
    public  ProductPost(){

    }

    // 获取帖子内

    // 检查帖子是否有图片


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getPushtype() {
        return pushtype;
    }

    public void setPushtype(String pushtype) {
        this.pushtype = pushtype;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getProducttype() {
        return producttype;
    }

    public void setProducttype(String producttype) {
        this.producttype = producttype;
    }

    public double getPrices() {
        return prices;
    }

    public void setPrices(double prices) {
        this.prices = prices;
    }

    public double getFreight() {
        return freight;
    }

    public void setFreight(double freight) {
        this.freight = freight;
    }

    public String getShipaddress() {
        return shipaddress;
    }

    public void setShipaddress(String shipaddress) {
        this.shipaddress = shipaddress;
    }

    public String getImageUri() {
        return imageUri;
    }

    public String getUserNumber() {
        return userNumber;
    }

    public void setUserNumber(String userNumber) {
        this.userNumber = userNumber;
    }

    public boolean isHasImage() {
        return hasImage;
    }

    public void setHasImage(boolean hasImage) {
        this.hasImage = hasImage;
    }

    public void setImageUri(String imageUri) {
        this.imageUri = imageUri;
        this.hasImage = (imageUri != null && !imageUri.isEmpty());
    }
    public boolean hasImage() {
        return this.hasImage = (imageUri != null && !imageUri.isEmpty());
    }

    @Override
    public String toString() {
        return "ProductPost{" +
                "id=" + id +
                ", pushtype='" + pushtype + '\'' +
                ", title='" + title + '\'' +
                ", producttype='" + producttype + '\'' +
                ", prices='" + prices + '\'' +
                ", freight='" + freight + '\'' +
                ", shipaddress='" + shipaddress + '\'' +
                ", imageUri='" + imageUri + '\'' +
                ", userNumber='" + userNumber + '\'' +
                ", hasImage=" + hasImage +
                '}';
    }
}


